package cn.itcast.fegin.fallback;

import cn.itcast.fegin.Feign.UserCilent;
import cn.itcast.fegin.pojo.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserCilent> {

    @Override
    public UserCilent create(Throwable throwable) {
        return new UserCilent() {
            @Override
            public User findById(Long id) {
                log.error("查询用户异常",throwable);
                System.err.println("查询用户异常~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
                return new User();
            }
        };
    }

}
